// RequestThread.cpp: implementation of the RequestThread class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "kwservercore.h"
#include "RequestThread.h"
#include "BaseRequestHandler.h"
#include "RequestThreadPool.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

RequestThread::RequestThread(BaseRequestHandler * pHandler):
	m_pHandler(pHandler)
{
	ASSERT(m_pHandler);
}

RequestThread::~RequestThread()
{
	delete m_pHandler;
}

bool RequestThread::ExitInstance()
{
	return CRequestThreadPool::Instance()->PostThreadMessage(WM_APP_REQUESTTHREADEXITED, (WPARAM)this, 0);
}

int RequestThread::Run()
{
	return m_pHandler->Handling();
}